package vek.GUI.MapView;

import javax.swing.*;
import java.awt.Dimension;
import java.awt.*;

/**
 * This class controls which components should be ontop, that is it sorts components into layers, the topmost layer gets shown first and can thus "obstruct" the view of the other layers.
 * @author Christian, Michal og Jakob (Hold1, gruppe 2)
 */
public class LayerHandler extends JLayeredPane{
    
   private Dimension dimensionPrefferedSizeOfComponents;
   
   private MarkingsView markingsPanel;
   private Background backgroundPanel;
  
/**
 * Creates a LayerHandler object, which contains the content shown in the scrollable part of Scrollableview i.e. MarkingsView and the Background.
 * @param sizeOfComponents size of the components which this component contains
 * @param mv The markingsView the markingsView component which this component is to contain
 * @param back the background component which this component is to contain
 */
    public LayerHandler(Dimension sizeOfComponents, MarkingsView mv, Background back)
    {
        //object creation
        markingsPanel = mv;
        backgroundPanel = back;
        dimensionPrefferedSizeOfComponents = sizeOfComponents;
        
        //variable change   
        setPreferredSize(dimensionPrefferedSizeOfComponents);
        
        //actions
        addContent();
    }

    /**
     * Adds components to this JComponent
     */
    
    private void addContent()
    {
       add(backgroundPanel, new Integer(10));
       add(markingsPanel, new Integer(300)); 
    }
    
}
